//
//  MBMessageListController.m
//  LiveBroadcast
//
//  Created by 肖剑 on 2019/4/10.
//  Copyright © 2019 moonBroadcast. All rights reserved.
//

#import "MBMessageListController.h"
#import "MBUserDetailController.h"
#import "MBUserCenterModel.h"
#import "MBIMController.h"
@interface MBMessageListController ()

@end

@implementation MBMessageListController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self setConversationAvatarStyle:RC_USER_AVATAR_CYCLE];
    
    //设置需要显示哪些类型的会话
    [self setDisplayConversationTypes:@[@(ConversationType_PRIVATE),
                                        @(ConversationType_DISCUSSION),
                                        @(ConversationType_CHATROOM),
                                        @(ConversationType_GROUP),
                                        @(ConversationType_APPSERVICE),
                                        @(ConversationType_SYSTEM)]];
    //设置需要将哪些类型的会话在会话列表中聚合显示
    [self setCollectionConversationType:@[@(ConversationType_DISCUSSION),
                                          @(ConversationType_GROUP)]];
    
}



/*!
 点击会话列表中Cell的回调
 
 @param conversationModelType   当前点击的会话的Model类型
 @param model                   当前点击的会话的Model
 @param indexPath               当前会话在列表数据源中的索引值
 
 @discussion 您需要重写此点击事件，跳转到指定会话的会话页面。
 如果点击聚合Cell进入具体的子会话列表，在跳转时，需要将isEnteredToCollectionViewController设置为YES。
 */
- (void)onSelectedTableRow:(RCConversationModelType)conversationModelType
         conversationModel:(RCConversationModel *)model
               atIndexPath:(NSIndexPath *)indexPath
{
    MBIMController *rcConverstionVC = [[MBIMController alloc]initWithConversationType:RC_CONVERSATION_MODEL_TYPE_NORMAL targetId:[NSString stringWithFormat:@"%@",model.targetId]];
    rcConverstionVC.userID = model.targetId;
    [self.navigationController pushViewController:rcConverstionVC animated:YES];
}

//- (void)didTapCellPortrait:(RCConversationModel *)model
//{
//    if ([[NSString stringWithFormat:@"%@",model.targetId] isEqualToString:[NSString stringWithFormat:@"%@",[MBUserModel sharedMBUserModel].userInfo.userId]]) {
//        NSDictionary *dict = @{
//                               @"userId":[MBUserModel sharedMBUserModel].userInfo.userId,
//                               @"beUserId":[MBUserModel sharedMBUserModel].userInfo.userId
//                               };
//        [MBHttpRequset requestWithUrl:kTradeid_userCenter_getPersonalData setParams:dict isShowProgressView:NO success:^(id  _Nonnull AJson) {
//            MBUserCenterModel *centerModel = [[MBUserCenterModel alloc]initWithDict:AJson];
//            MBUserDetailController *detailVC = [[MBUserDetailController alloc]init];
//            detailVC.userModel = centerModel;
//            [self.navigationController pushViewController:detailVC animated:YES];
//        } failure:^(id  _Nonnull AJson) {
//        }];
//    }else{
//        [self.navigationController popViewControllerAnimated:YES];
//    }
//}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
